import React from 'react';
import _ from 'lodash';

export const SEARCH_TYPE = [
  {
    id: 0,
    label: '按日查询',
    value: 0,
  },
  {
    id: 1,
    label: '按周查询',
    value: 1,
  },
  {
    id: 2,
    label: '按月查询',
    value: 2,
  },
];

export const monthPieDic = {
  hydroPowerIncome: '水电',
  windPowerIncome: '风电',
  photoVoltaicIncome: '光伏',
};

export const monthChart = [
  {
    title: {
      top: '33%',
      right: '4.5%',
      textAlign: 'auto',
      textStyle: {
        color: '#ffffff',
        fontSize: 14,
      },
    },
    chartName: '多业态收入占比',
    diy: true,
    tooltip: {
      trigger: 'item',
    },
    legend: {
      selected: {
        风电: true,
        windPowerIncome: true,
      },
      icon: 'pin',
      orient: 'vertical',
      top: '40%',
      right: '5%',
      itemStyle: {
        borderWidth: 0,
      },
      textStyle: {
        color: '#ffffff',
      },
    },
    series: [
      {
        color: ['#2174FF', '#07A872', '#D29E08'],
        bottom: 10,
        selectedMode: false,
        type: 'pie',
        radius: ['50%', '80%'],
        avoidLabelOverlap: false,
        label: {
          formatter: `{name1|收入占比}\n{name2|{d}%}\n{name3|{b}}`,
          show: false,
          position: 'center',
          rich: {
            name1: {
              fontSize: 20,
              align: 'center',
              padding: [0, 0, 0, 15],
            },
            name2: {
              fontSize: 40,
              align: 'left',
              padding: [10, 0, 0, 7],
            },
            name3: {
              fontSize: 20,
              align: 'center',
              padding: [10, 0, 0, 6],
            },
          },
        },
        emphasis: {
          scaleSize: 20, // 设置扇形拉伸的长度
          label: {
            show: true,
            fontSize: 25,
            color: '#ffffff',
          },
        },
        labelLine: {
          show: false,
        },
      },
    ],
  },
  {
    chartName: '场站总览',
    grid: { top: 20, left: 48, bottom: 50, right: 36 },
    tooltip: {},
    legend: {},
    yAxis: [
      {
        type: 'value',
      },
      {
        splitLine: { show: false },
        type: 'value',
      },
    ],
  },
];

const unitStyle = { color: 'rgba(255, 255, 255, 0.6)', fontSize: 12, lineHeight: '20px' };

export const weekIndexMap = {
  totalOngridQuantity: { name: '总上网电量', type: 'bar', color: '#5795CD' },
  ongridTaxPrice: {
    name: '上网电价(含税)',
    type: 'line',
    color: '#E6E963',
    props: {
      symbol: 'circle',
    },
  },
  _averagePrice: {
    name: '价格均价',
    type: 'dashed',
    color: '#F6925A',
    props: {
      symbol: 'circle',
    },
  },

  longTermContractQuantity: {
    name: '中长期合约电量',
    type: 'bar',
    color: '#2174FF',
    props: { stack: 'one' },
  },
  provincialDayaheadQuantity: {
    name: '省内日前电量',
    type: 'bar',
    color: '#3CB1FB',
    props: { stack: 'one' },
  },
  provincialRealtimeQuantity: {
    name: '省内实时电量',
    type: 'bar',
    color: '#07A872',
    props: { stack: 'one' },
  },
  provincialInterDayaheadQuantity: {
    name: '省间日前电量',
    type: 'bar',
    color: '#D29E08',
    props: { stack: 'one' },
  },
  provincialInterIntradayQuantity: {
    name: '省间日内电量',
    type: 'bar',
    color: '#ED8139',
    props: { stack: 'one' },
  },

  longTermContractPrice: {
    name: '中长期合约电价',
    type: 'line',
    props: { symbol: 'circle' },
    color: '#5795CD',
  },
  provincialDayaheadAveragePrice: {
    name: '省内日前均价',
    type: 'line',
    props: { symbol: 'circle' },
    color: '#2BDAE5',
  },
  provincialRealtimeAveragePrice: {
    name: '省内实时均价',
    type: 'line',
    props: { symbol: 'circle' },
    color: '#E6E963',
  },
  provincialInterDayaheadAveragePrice: {
    name: '省间日前均价',
    type: 'line',
    props: { symbol: 'circle' },
    color: '#18A0FB',
  },
  provincialInterIntradayAveragePrice: {
    name: '省间日内均价',
    type: 'line',
    props: { symbol: 'circle' },
    color: '#F67E26',
  },
};

export const weekChartsMap = {
  场站总览: ['totalOngridQuantity', 'ongridTaxPrice', '_averagePrice'],
  电量分析: [
    'longTermContractQuantity',
    'provincialDayaheadQuantity',
    'provincialRealtimeQuantity',
    'provincialInterDayaheadQuantity',
    'provincialInterIntradayQuantity',
  ],
  电价分析: [
    'longTermContractPrice',
    'provincialDayaheadAveragePrice',
    'provincialRealtimeAveragePrice',
    'provincialInterDayaheadAveragePrice',
    'provincialInterIntradayAveragePrice',
  ],
};

export const weekColumns = [
  {
    name: '',
    width: 106,
    code: 'stationName',
  },
  {
    code: 'stationCapacity',
    name: (
      <div>
        装机容量
        <div style={unitStyle}>(万千瓦)</div>
      </div>
    ),
  },
  {
    code: 'totalOngridQuantity',
    name: (
      <div>
        总上网电量
        <div style={unitStyle}>(万千瓦时)</div>
      </div>
    ),
  },
  {
    code: 'ongridTaxPrice',
    width: 112,
    name: (
      <div>
        上网电价(含税)
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
  },
  {
    code: 'longTermContractQuantity',
    width: 100,
    name: (
      <div>
        中长期合约电量
        <div style={unitStyle}>(万千瓦时)</div>
      </div>
    ),
  },
  {
    code: 'longTermContractPrice',
    width: 100,
    name: (
      <div>
        中长期合约电价
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
  },
  {
    code: 'provincialDayaheadQuantity',
    name: (
      <div>
        省内日前电量
        <div style={unitStyle}>(万千瓦时)</div>
      </div>
    ),
  },
  {
    code: 'provincialDayaheadAveragePrice',
    name: (
      <div>
        省内日前均价
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
  },
  {
    code: 'provincialRealtimeQuantity',
    name: (
      <div>
        省内实时电量
        <div style={unitStyle}>(万千瓦时)</div>
      </div>
    ),
  },
  {
    code: 'provincialRealtimeAveragePrice',
    name: (
      <div>
        省内实时均价
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
  },
  {
    code: 'provincialInterDayaheadQuantity',
    name: (
      <div>
        省间日前电量
        <div style={unitStyle}>(万千瓦时)</div>
      </div>
    ),
  },
  {
    code: 'provincialInterDayaheadAveragePrice',
    name: (
      <div>
        省间日前均价
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
  },
  {
    code: 'provincialInterIntradayQuantity',
    name: (
      <div>
        省间日内电量
        <div style={unitStyle}>(万千瓦时)</div>
      </div>
    ),
  },
  {
    code: 'provincialInterIntradayAveragePrice',
    name: (
      <div>
        省间日内均价
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
  },
  {
    code: 'otherRevenue',
    name: (
      <div>
        其他收入
        <div style={unitStyle}>(万元)</div>
      </div>
    ),
  },
  {
    code: 'ongridTaxExclusivePrice',
    name: (
      <div>
        上网电价(不含税)
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
    width: 127,
  },
  {
    code: 'variableCostTaxExclusive',
    name: (
      <div>
        变动成本(不含税)
        <div style={unitStyle}>(元/MWh)</div>
      </div>
    ),
    width: 127,
  },
];

export const COLIMNSTYPEOPTION = [
  '日前出清电量电费',
  '实时出清电量电费',
  '执行偏差',
  '资金池分摊',
  '收益分析',
  '电量核对',
].map((t) => ({
  label: t,
  value: t,
}));

export const TYPE_OPTIONS = [
  { label: '全部', value: 0 },
  { label: '风电', value: 3 },
  { label: '光伏', value: 4 },
];

export const canEditorList = ['关口表上网电量', '机侧发电量'];
